//
// Created by 覃州 on 2024/4/8.
//

#ifndef CANON_SINGLETON_H
#define CANON_SINGLETON_H

#include <memory>

namespace canon {

template <class T, class X = void, int N = 0>
class Singleton {
public:
    static T *GetInstance()
    {
        static T v;
        return &v;
    }
};

template <class T, class X = void, int N = 0>
class SingletonPtr {
public:
    static std::shared_ptr<T> GetInstance() {
        static std::shared_ptr<T> v(new T);
        return v;
    }
};

}

#endif //CANON_SINGLETON_H
